package cn.chenhongchao.zhaobiaopingtai.controller;

import cn.chenhongchao.zhaobiaopingtai.common.api.CommonPage;
import cn.chenhongchao.zhaobiaopingtai.common.api.CommonResult;
import cn.chenhongchao.zhaobiaopingtai.dto.ReturnBidDTO;
import cn.chenhongchao.zhaobiaopingtai.dto.TenderDTO;
import cn.chenhongchao.zhaobiaopingtai.entity.Bid;
import cn.chenhongchao.zhaobiaopingtai.entity.ReturnBid;
import cn.chenhongchao.zhaobiaopingtai.service.impl.BidServiceImpl;
import cn.chenhongchao.zhaobiaopingtai.service.impl.TenderServiceImpl;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/tenderEvaluation")
@Api(value = "tenderReturn", tags = "tenderReturn")
@CrossOrigin
public class TenderEvaluationController {

    @Autowired
    private BidServiceImpl bidService;

    @Autowired
    private TenderServiceImpl tenderService;

    @RequestMapping("getTenderEvaluation")
    public CommonResult getTenderReturn(@RequestParam(value = "page", required = false) Integer pageNum,
                                        @RequestParam(value = "size", required = false) Integer pageSize,
                                        @RequestBody ReturnBidDTO returnBidDTO) {
        if (pageNum == null) {
            pageNum = 1;
        }

        if (pageSize == null) {
            pageSize = 1;
        }

        List<TenderDTO> tenderEvaluation = tenderService.getTenderEvaluation(pageNum, pageSize);
        return CommonResult.success(CommonPage.restPage(tenderEvaluation));
    }
    }

